#ifndef PARSER_H
#define PARSER_H
#include <vector>
#include <string>
#include <memory>
#include "dbinterface.h"
#include "connection.h"
#include "connectionclosedexception.h"

class Parser {

public:
	Parser(dbinterface* db);
	std::vector<unsigned char> handle_input(const std::shared_ptr<Connection>& conn);
	void push_string(std::vector<unsigned char> &output, std::string input);
	void push_int(std::vector<unsigned char> &output, unsigned int input);
	void push_int_no_flag(std::vector<unsigned char> &output, unsigned int input);
	std::string translate(unsigned char c);
	std::string create_string(const std::shared_ptr<Connection>& conn, unsigned int len);
	std::string capture_string(const std::shared_ptr<Connection>& conn); 
	unsigned int capture_int(const std::shared_ptr<Connection>& conn);
	unsigned int parse_int(const std::shared_ptr<Connection>& conn);
private:
	dbinterface* db;
};

#endif
